package test;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class QueryContentAction extends HttpServlet{

 public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    
{

	    try{
		    String title= request.getParameter("title");  
		    DownLoadFile downfile= new DownLoadFile();	
		    String str=downfile.readFromHdfs(title);
		    request.setAttribute("str", str);
			RequestDispatcher rd = request
			.getRequestDispatcher("/queryContent.jsp");
	        rd.forward(request, response);
            return ;
	    }catch(Exception ex){
			RequestDispatcher rd = request
			.getRequestDispatcher("/error.jsp");
	         rd.forward(request, response);
	         return;
	    }

}
}
